﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Admin.aspx.cs" Inherits="Admin" %>
<%@ Register Src="~/App_Widget/Navbar.ascx" TagName="navbar" TagPrefix="UITag" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>


</head>
<body>
    <UITag:navbar runat="server" ID="navbar" />
    <form id="form1" runat="server">
        <div class="container">
            <div class="page-header">
                <h1>管理页面 <small></small></h1>
            </div>
            <div id="main-container">
                <!-- Nav tabs -->
                <ul class="nav nav-tabs" role="tablist">
                    <li class="active"><a href="#home" role="tab" data-toggle="tab">状态</a></li>
                    <li><a href="#holder-check" role="tab" data-toggle="tab">房主审核</a></li>
                    <li><a href="#house-check" role="tab" data-toggle="tab">房屋审核</a></li>
                    <li><a href="#holder-manage" role="tab" data-toggle="tab">房主管理</a></li>
                    <li><a href="#house-manage" role="tab" data-toggle="tab">房屋管理</a></li>
                </ul>


                <!-- Tab panes -->
                <div class="tab-content">
                    <div class="tab-pane active" id="home">
                        <table class="table">
                            <tr>
                                <td>总会员数</td>
                                <td> <%#BLL.PersonalInformationManage.Count() %></td> 
                            </tr>
                            <tr>
                                <td>房主</td>
                                <td> <%#BLL.HouseHolderManage.Count() %></td> 
                            </tr>
                            <tr>
                                <td>客户</td>
                                <td> <%#BLL.ClientManage.Count() %></td> 
                            </tr>
                            <tr>
                                <td>房屋</td>
                                <td> <%#BLL.HouseHolderManage.Count() %></td> 
                            </tr>
                            <tr>
                                <td>待审核房主</td>
                                <td> <%#BLL.HouseHolderManage.GetHouseHoldersNotChecked().Count() %></td> 
                            </tr>
                            <tr>
                                <td>待审核房屋</td>
                                <td> <%#BLL.HouseManage.GetHousesNotChecked().Count() %></td> 
                            </tr>
                      
                        </table>
                        
                    </div>
                    <div class="tab-pane" id="holder-check">
                        <asp:GridView ID="gvHHoldersNotChecked" runat="server" OnRowUpdating="HouseHolderChecked">
                            <Columns>
                                <asp:ButtonField ControlStyle-CssClass="btn btn-default btn-sm" ButtonType="Button" CommandName="Update" Text="通过" />
                            </Columns>
                        </asp:GridView>
                    </div>
                    <div class="tab-pane" id="house-check">
                        <asp:GridView ID="gvHouseNotChecked" runat="server" OnRowUpdating="HouseChecked">
                            <Columns>
                                <asp:ButtonField ButtonType="Button" CommandName="Update" Text="通过" />
                            </Columns>
                        </asp:GridView>
                    </div>
                    <div class="tab-pane" id="holder-manage">
                        <div id="holder-manage-controller">
                        </div>
                        <table class="table">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>姓名</th>
                                    <th>昵称</th>
                                    <th>邮箱</th>
                                    <th>注册时间</th>
                                    <th>评分</th>
                                    <th>推荐</th>
                                </tr>
                            </thead>
                            <tbody>
                            <asp:Repeater ID="rptHolderManage" runat="server">
                                <ItemTemplate>
                                    
                                        <tr>
                                            <td><%#BLL.HouseHolderManage.GetIdByPersonalInformationId(Convert.ToInt32(Eval("Id"))) %></td>
                                            <td><%#Eval("Name") %></td>
                                            <td><%#Eval("Nickname") %></td>
                                            <td><%#Eval("Email") %></td>
                                            <td><%#Eval("RegisterTime") %></td>
                                            <th>
                                                <asp:TextBox runat="server" style="width:40px" TextMode="Number" tbType="Rating" HolderId='<%#BLL.HouseHolderManage.GetIdByPersonalInformationId(Convert.ToInt32(Eval("Id"))) %>'
                                                    Text='<%#BLL.HouseHolderManage.GetHouseHolderByPersonalInformationId(Convert.ToInt32(Eval("Id"))).EvaluationScore %>'></asp:TextBox>
                                            </th>
                                            <td>
                                                <asp:CheckBox HouseId='<%#Eval("Id") %>' cbType="Recommend" HolderId='<%#BLL.HouseHolderManage.GetIdByPersonalInformationId(Convert.ToInt32(Eval("Id"))) %>'
                                                    Checked='<%#Convert.ToBoolean(BLL.HouseHolderManage.GetHouseHolderByPersonalInformationId(Convert.ToInt32(Eval("Id"))).IsRecommended) %>' runat="server" />
                                            </td>
                                        </tr>
                                </ItemTemplate>
                            </asp:Repeater>
                                </tbody>
                            <tfoot>
                                <tr>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td>
                                        <asp:Button runat="server" Text="提交" CssClass="btn btn-sm btn-primary" OnClick="HolderManageClick"/>
                                    </td>
                                
                                </tr>
                                
                            </tfoot>

                        </table>
                    </div>
                    <div class="tab-pane" id="house-manage">
                        <div id="house-manage-controller">
                        </div>
                        <table class="table">
                            <thead>
                                <tr>
                               
                                    <th>#</th>
                                    <th>地址</th>
                                    <th>房间数量</th>
                                    <th>价格</th>
                                    <th>发布时间</th>
                                    <th>状态</th>
                                    <th>评分</th>
                                    <th>评价</th>
                                    <th>推荐</th>
                                </tr>
                            </thead>
                            <tbody>
                            <asp:Repeater ID="rptHouseManage" runat="server">
                                <ItemTemplate>
                                    
                                        <tr>
                                           
                                            <td><%#Eval("Id") %></td>
                                            <td><%#Eval("Address") %></td>
                                            <td><%#Eval("RoomNumber") %></td>
                                            <td><%#Eval("Price") %></td>
                                            <td><%#Eval("PublishTime") %></td>
                                            <td><%#(Model.StatusCodeName)Eval("StatusCodeId") %></td>
                                            <td>
                                                <asp:TextBox HouseId='<%#Eval("Id") %>' tbType="Rating" runat="server" TextMode="Number" style="width:40px" Text='<%#Eval("Rating") %>' ></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:TextBox HouseId='<%#Eval("Id") %>' tbType="AdminReview" runat="server"  style="width:200px" Text='<%#Eval("AdminReview") %>'></asp:TextBox>
                                            </td>
                                            <td>
                                                <asp:CheckBox HouseId='<%#Eval("Id") %>' cbType="Recommend" Checked='<%# Convert.ToBoolean(Eval("IsRecommended")) %>' runat="server" />
                                            </td>
                                        </tr>
                                </ItemTemplate>
                            </asp:Repeater>
                                </tbody>
                            <tfoot>
                                <tr>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td></td>
                                    <td>
                                        <asp:Button runat="server" Text="提交" CssClass="btn btn-sm btn-primary" OnClick="HouseManageClick"/>
                                    </td>
                                
                                </tr>
                                
                            </tfoot>

                        </table>
                    </div>
                </div>
            </div>
        </div>
    </form>

    <script>
        $('#gvHHoldersNotChecked').addClass("table");
        $('#gvHHoldersNotChecked').attr("rules", "");
        $('#gvHHoldersNotChecked').attr("border", 0);

        $('#gvHouseNotChecked').addClass("table");
        $('#gvHouseNotChecked').attr("rules", "");
        $('#gvHouseNotChecked').attr("border", 0);

    </script>
</body>
</html>
